*set pathway


*include dataset

*************
*Analysis:	*
*************


capture cd "/Users/marianne/PRIO Dropbox/Marianne Dahl/Defection dataset/StrategyPaper/Analysis"





use "masterdata_defect.dta", clear



*Table 2	Strategy and Disloyalty	strategy_aggregated1.tex

logit defect_dummy  NONVIOL  part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript  , cluster(id)

logit defect_10000  NONVIOL   part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur  conscript , cluster(id)

logit defect_most NONVIOL   part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)


*Table A2	Aggregated Disloyalty: Results without participation	Results_EDT/strategy_without_size.tex

logit defect_dummy NONVIOL  log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

logit defect_10000  NONVIOL   log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

logit defect_most NONVIOL  log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript , cluster(id)


*Table A3	Aggregated Disloyalty: Parsimonious model	Results_EDT/strategy_aggregated_parsimonious.tex
logit defect_dummy NONVIOL part_log dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
logit defect_10000 NONVIOL part_log dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
logit defect_most NONVIOL part_log dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
logit defect_dummy NONVIOL dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
logit defect_10000 NONVIOL dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
logit defect_most NONVIOL dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)


*Table A4	Jackknife models: Aggregated disloyalty	Results_EDT/Strategy_aggregated1_JK.tex
logit defect_dummy  NONVIOL  part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript,  vce(jackknife, nodots)

logit defect_10000  NONVIOL   part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript,  vce(jackknife, nodots)

logit defect_most NONVIOL   part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript,  vce(jackknife, nodots)

*Table A5	Aggregated Disloyalty - added controls: Ethnic fractionalization	Results_EDT/strategy_aggregated_EF.tex

logit defect_dummy NONVIOL   EFindex part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL   EFindex part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL   EFindex part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

logit defect_dummy NONVIOL   EFindex  log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL   EFindex log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL  EFindex  log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

*Table A6	Aggregated Disloyalty - added controls: Education	Results_EDT/strategy_aggregated_edu.tex

logit defect_dummy NONVIOL  part_log log_pop upop_share total_edu_i_add_1 REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL    part_log log_pop upop_share total_edu_i_add_1 REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL   REGCHANGE part_log log_pop upop_share total_edu_i_add_1 dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

logit defect_dummy NONVIOL    log_pop upop_share total_edu_i_add_1 REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL    log_pop upop_share total_edu_i_add_1 REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL  REGCHANGE log_pop upop_share total_edu_i_add_1 dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

*Table A7	Aggregated Disloyalty - added controls: Natural resources	Results_EDT/strategy_aggregated_natres.tex
logit defect_dummy NONVIOL   e_total_resources_income_pc part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL   e_total_resources_income_pc part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL   e_total_resources_income_pc part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

logit defect_dummy NONVIOL  e_total_resources_income_pc  log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL   e_total_resources_income_pc log_pop upop_share REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL   e_total_resources_income_pc log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)


*Table A8	Aggregated Disloyalty - added controls: Personalism	Results_EDT/strategy_aggregated_personalism.tex
logit defect_dummy NONVIOL   v2x_neopat part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL v2x_neopat part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL v2x_neopat part_log log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

logit defect_dummy NONVIOL  v2x_neopat  log_pop upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_10000 NONVIOL   v2x_neopat  log_pop upop_share REGCHANGE dec_1970 dec_1980 dec_1990 repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
logit defect_most NONVIOL  v2x_neopat  log_pop upop_share  REGCHANGE  dec_1970 dec_1980 dec_1990  repr_some  repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)

*Table A9	Aggregated Disloyalty: CRE Models	Results/strategy_aggregated_CRE.tex
foreach v of varlist part_log log_pop  upop_share e_gdppc v2x_libdem regdur {
	bysort id: egen avr_`v' = mean(`v')
}

xtset id year
xtprobit defect_dummy  NONVIOL part_log log_pop upop_share  REGCHANGE repr_some repr_much   i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur 		conscrip dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit defect_10000  NONVIOL  part_log log_pop upop_share REGCHANGE repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit defect_most NONVIOL  part_log log_pop upop_share REGCHANGE repr_some repr_much i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re

xtprobit defect_dummy NONVIOL log_pop upop_share REGCHANGE repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript dec_1970 dec_1980 dec_1990  avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit defect_10000  NONVIOL  log_pop upop_share REGCHANGE repr_some repr_much   i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript dec_1970 dec_1980 dec_1990  avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit defect_most NONVIOL log_pop upop_share  REGCHANGE repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript dec_1970 dec_1980 dec_1990  avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 


*Table A10	Types of disloyalty	Results_EDT/typesofstrategy_withsize.tex
gen other_sec_quit=1 if sec_desert ==1 | sec_voice_broad ==1 | sec_join ==1 | sec_idle ==1 | sec_barracking ==1 | sec_coup==1
replace other_sec_quit=0 if other_sec_quit==.

gen other_sec_desert=1 if sec_quit ==1 | sec_voice_broad ==1 | sec_join ==1 | sec_idle ==1 | sec_barracking ==1 | sec_coup==1
replace other_sec_desert=0 if other_sec_desert==.

gen other_sec_join=1 if sec_quit ==1 | sec_voice_broad ==1 | sec_desert ==1 | sec_idle ==1 | sec_barracking ==1 | sec_coup==1
replace other_sec_join=0 if other_sec_join==.

gen other_sec_voice_broad=1 if sec_quit ==1 | sec_join ==1 | sec_desert ==1 | sec_idle ==1 | sec_barracking ==1 | sec_coup==1
replace other_sec_voice_broad=0 if other_sec_voice_broad==.

gen other_sec_idle=1 if sec_quit ==1 | sec_voice_broad ==1 | sec_desert ==1 | sec_join ==1 | sec_barracking ==1 | sec_coup==1
replace other_sec_idle=0 if other_sec_idle==.

gen other_sec_barracking=1 if sec_quit ==1 | sec_voice_broad ==1 | sec_desert ==1 | sec_idle ==1 | sec_join ==1 | sec_coup==1
replace other_sec_barracking=0 if other_sec_barracking==.

gen other_sec_coup=1 if sec_quit ==1 | sec_voice_broad ==1 | sec_desert ==1 | sec_idle ==1 | sec_barracking ==1 | sec_join==1
replace other_sec_coup=0 if other_sec_coup==.

gen other=.

foreach j in sec_idle sec_barracking sec_desert sec_join sec_voice_broad sec_quit sec_coup {
    replace other = other_`j'
    logit `j' NONVIOL part_log other log_pop upop_share REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
    estimates store `j'
}


*Figure 3 Coefficient-plots for the effect of a nonviolent (vs. a violent) strategy

label var NONVIOL " "

coefplot ///
(sec_idle, label(Shirk) mcolor(black) msymbol(triangle) msize(medium) ciopts(color(black))) ///
(sec_barracking, label(Barrack) mcolor(black) msymbol(square) msize(medium) ciopts(color(black))) ///
(sec_desert, label(Desert) mcolor(black) msymbol(circle) msize(medium) ciopts(color(black))) ///
(sec_join, label(Side-switch) mcolor(black) msymbol(diamond) msize(medium) ciopts(color(black))) ///
(sec_voice_broad, label(Voice) mcolor(gs8) msymbol(triangle) msize(medium) ciopts(color(gs8))) ///
(sec_quit, label(Quit regime) mcolor(gs8) msymbol(square) msize(medium) ciopts(color(gs8))) ///
(sec_coup, label(Coup) mcolor(gs8) msymbol(circle) msize(medium) ciopts(color(gs8))), ///
keep(NONVIOL) xline(0, lcolor(black) lpattern(solid)) ///
xscale(range(-7(1)6)) xlabel(-7(1)6) ///
graphregion(color(white)) plotregion(color(white)) 


*Table A11	Types of disloyalty: Desertion and side-switching merged	Results_EDT/merged.tex

gen sec_desert_switch=1 if sec_desert ==1 | sec_join ==1
replace sec_desert_switch=0 if sec_desert_switch==.

gen other_sec_desert_switch=1 if sec_quit ==1 | sec_voice_broad ==1 | sec_idle ==1 | sec_barracking ==1 | sec_coup==1
replace other_sec_desert_switch=0 if other_sec_desert_switch==.


foreach j in sec_idle sec_barracking  sec_desert_switch  sec_voice_broad  sec_quit  sec_coup{
	replace other= other_`j'
	logit `j' NONVIOL part_log other  log_pop upop_share REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much   i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
}


*Table A12	Types of disloyalty: Parsimonious model	Results_EDT/typesofstrategy_parsimonious.tex
foreach j in sec_idle sec_barracking  sec_desert  sec_join  sec_voice_broad  sec_quit  sec_coup{
	replace other=.
	replace other= other_`j'
	logit `j' NONVIOL other part_log dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
}

*Table A13	Types of disloyalty: Parsimonious model (without size)	Results_EDT/typesofstrategy_parsimonious_WOS.tex
foreach j in sec_idle sec_barracking  sec_desert  sec_join  sec_voice_broad  sec_quit  sec_coup{
	replace other=.
	replace other= other_`j'
	logit `j' NONVIOL other dec_1970 dec_1980 dec_1990 i.e_regionpol_6C, cluster(id)
}

*Table A14	Types of disloyalty - added controls: Ethnic Fractionalization	Results_EDT/typesofdisloyalty_EF.tex
foreach j in sec_idle sec_barracking  sec_desert sec_join  sec_voice_broad  sec_quit  sec_coup{
	replace other= other_`j'
	logit `j' NONVIOL other  EFindex REGCHANGE part_log upop_share  dec_1970 dec_1980 dec_1990 repr_some repr_much log_pop  ///
	i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur , cluster(id)
}

*Table A15	Types of disloyalty - added controls: Education	Results_EDT/Typesofdisloyalty_edu.tex
foreach j in sec_idle sec_barracking  sec_desert  sec_join  sec_voice_broad  sec_quit  sec_coup{
	replace other= other_`j'
	logit `j' NONVIOL total_edu_i_add_1 other  REGCHANGE part_log upop_share  dec_1970 dec_1980 dec_1990 repr_some repr_much log_pop  ///
	i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur , cluster(id)
}


*Table A16	Types of disloyalty - added controls: Natural resources	Results_EDT/Types_NaturalResources.tex
foreach j in sec_idle sec_barracking  sec_desert  sec_join  sec_voice_broad  sec_quit sec_coup {
	replace other= other_`j'
	logit `j' NONVIOL other  e_total_resources_income_pc REGCHANGE  part_log upop_share  dec_1970 dec_1980 dec_1990 repr_some repr_much log_pop  ///
	i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur , cluster(id)
}


*Table A17	Types of disloyalty - added controls: Personalism	Results_EDT/typesofstrategy_personalism.tex
foreach j in sec_idle sec_barracking  sec_desert  sec_join  sec_voice_broad  sec_quit  sec_coup{
	replace other= other_`j'
	logit `j' NONVIOL other v2x_neopat REGCHANGE part_log upop_share  dec_1970 dec_1980 dec_1990 repr_some repr_much log_pop  ///
	i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur , cluster(id)

}

*Table A18	Types of disloyalty: CRE-models	Results/strategy_defect_disaggregate_controls_CRE.tex
xtprobit sec_idle NONVIOL  part_log upop_share log_pop  REGCHANGE repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur  dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit sec_barracking NONVIOL  upop_share part_log log_pop  REGCHANGE  repr_some repr_much i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re

xtprobit sec_desert NONVIOL  part_log upop_share  REGCHANGE    repr_some repr_much  log_pop i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit sec_join NONVIOL  part_log upop_share  log_pop REGCHANGE  repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit sec_voice_broad TerrainRuggednessIndex100mN NONVIOL REGCHANGE repr_much  log_pop part_log dec_1970 dec_1980 dec_1990 i.e_regionpol_6C e_gdppc v2x_libdem regdur upop_share   avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 

xtprobit sec_quit NONVIOL  part_log upop_share  REGCHANGE  repr_some repr_much log_pop  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur  dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 
estimates store  G

xtprobit sec_coup NONVIOL  upop_share part_log log_pop  REGCHANGE  repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur dec_1970 dec_1980 dec_1990 avr_part_log avr_log_pop avr_upop_share avr_e_gdppc avr_v2x_libdem avr_regdur, re 


*Table A19	Effect of strategy on types of disloyalty: Jackknife models	Results_EDT/typesofstrategy_jack-knife.tex
foreach j in sec_idle sec_barracking  sec_desert  sec_join  sec_voice_broad  sec_quit  sec_coup{
	replace other= other_`j'
	logit `j' NONVIOL other part_log  upop_share  REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much  i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript log_pop , vce(jackknife, nodots)

}


*Table A20	Types of disloyalty: Exclusively military disloyalty campaign-years	Results_EDT/typesofdisloyalty_onlymilitary.tex
foreach i in sec_desert sec_voice_broad sec_join sec_idle sec_barracking sec_coup {
    replace `i' = 0 if `i' == 1 & only_nonmilitary == 1
}

gen other_sec_quit = 1 if sec_desert == 1 | sec_voice_broad == 1 | sec_join == 1 | sec_idle == 1 | sec_barracking == 1 | sec_coup == 1
replace other_sec_quit = 0 if other_sec_quit == .

gen other_sec_desert = 1 if sec_quit == 1 | sec_voice_broad == 1 | sec_join == 1 | sec_idle == 1 | sec_barracking == 1 | sec_coup == 1
replace other_sec_desert = 0 if other_sec_desert == .

gen other_sec_join = 1 if sec_quit == 1 | sec_voice_broad == 1 | sec_desert == 1 | sec_idle == 1 | sec_barracking == 1 | sec_coup == 1
replace other_sec_join = 0 if other_sec_join == .

gen other_sec_voice_broad = 1 if sec_quit == 1 | sec_join == 1 | sec_desert == 1 | sec_idle == 1 | sec_barracking == 1 | sec_coup == 1
replace other_sec_voice_broad = 0 if other_sec_voice_broad == .

gen other_sec_idle = 1 if sec_quit == 1 | sec_voice_broad == 1 | sec_desert == 1 | sec_join == 1 | sec_barracking == 1 | sec_coup == 1
replace other_sec_idle = 0 if other_sec_idle == .

gen other_sec_barracking = 1 if sec_quit == 1 | sec_voice_broad == 1 | sec_desert == 1 | sec_idle == 1 | sec_join == 1 | sec_coup == 1
replace other_sec_barracking = 0 if other_sec_barracking == .

gen other_sec_coup = 1 if sec_quit == 1 | sec_voice_broad == 1 | sec_desert == 1 | sec_idle == 1 | sec_barracking == 1 | sec_join == 1
replace other_sec_coup = 0 if other_sec_coup == .

gen other = .

foreach j in sec_idle sec_barracking sec_desert sec_join sec_voice_broad sec_quit sec_coup {
    replace other = other_`j'
    eststo: logit `j' NONVIOL part_log other log_pop upop_share REGCHANGE dec_1970 dec_1980 dec_1990 repr_some repr_much ///
        i.e_regionpol_6C TerrainRuggednessIndex100mN e_gdppc v2x_libdem regdur conscript, cluster(id)
    estimates store `j'
}





*Figure A1: Frequency of co-occurrence of different types of disloyalty 

gen n_disloyalty=0
foreach j in sec_quit sec_desert sec_voice_broad sec_join sec_idle sec_barracking sec_coup {
	replace n_disloyalty = n_disloyalty +1 if `j'==1
}

label var n_disloyalty "Number of Different Disloyalty Types"

drop if n_disloyalty==0
histogram n_disloyalty, discrete frequency ///
    xlabel(1 "1" 2 "2" 3 "3" 4 "4" 5 "5") 
	
